package com.learn.domain;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/4/7.
 */
@Entity
public class Questionaire extends BaseObject {
    public Questionaire() {

    }

    public Questionaire(Long id, String questionaireName, User author, String auditDepartment) {
        setId(id);
        this.questionaireName = questionaireName;
        this.author = author;
        this.auditDepartment = auditDepartment;
    }


    public String questionaireName;

    @ManyToOne
    public User author;

    @OneToMany
    public List<Risk> riskList;


    public String auditDepartment;


    public String getQuestionaireName() {
        return questionaireName;
    }

    public void setQuestionaireName(String questionaireName) {
        this.questionaireName = questionaireName;
    }

    public User getAuthor() {
        return author;
    }

    public void setAuthor(User author) {
        this.author = author;
    }

    public List<Risk> getRiskList() {
        return riskList;
    }

    public void setRiskList(List<Risk> riskList) {
        this.riskList = riskList;
    }

    public void addRiskList(Risk risk){
        if(riskList == null){
            riskList = new ArrayList<Risk>();
        }
        riskList.add(risk);
    }


    public String getAuditDepartment() {
        return auditDepartment;
    }

    public void setAuditDepartment(String auditDepartment) {
        this.auditDepartment = auditDepartment;
    }
}
